package com.lvchenglong.task;

import com.lvchenglong.JvmTestApp;
import com.lvchenglong.model.User;

import java.time.LocalDate;

public class TaskHighMemory implements Runnable{
    private User user = new User();

    @Override
    public void run() {
        while(true) {
            System.out.println("TaskHighMemory: " + Thread.currentThread().getName());
            user = new User();
            user.setBody(JvmTestApp.sampleBytes);
            user.setName(LocalDate.now().toString());
            user.setId(0);

            JvmTestApp.staticTimeList.add(LocalDate.now().toString() + " / " + Thread.currentThread().getName());
            try {
                Thread.sleep(100);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
